Unit fadepodurum;

Interface

Uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Grids, Wwdbigrd, Wwdbgrid, wwdbdatetimepicker, Db, ADODB,
  siComp;

Type
  Tfadepodurm = Class(TForm)
    Label1: TLabel;
    t1: TwwDBDateTimePicker;
    t2: TwwDBDateTimePicker;
    Label2: TLabel;
    wwDBGrid1: TwwDBGrid;
    Button1: TButton;
    Button2: TButton;
    onay: TButton;
    Button4: TButton;
    durum: TADOQuery;
    Procedure Button2Click(Sender: TObject);
    Procedure FormClose(Sender: TObject; Var Action: TCloseAction);
    Procedure Button1Click(Sender: TObject);
    Procedure Button4Click(Sender: TObject);
    Procedure wwDBGrid1CalcCellColors(Sender: TObject; Field: TField;
      State: TGridDrawState; Highlight: Boolean; AFont: TFont;
      ABrush: TBrush);
    Procedure onayClick(Sender: TObject);
  Private
    { Private declarations }
  Public
    { Public declarations }
  End;

Var
  fadepodurm: Tfadepodurm;

Implementation

Uses data, udmTeknik, dmrap, ana1;

{$R *.DFM}

Procedure Tfadepodurm.Button2Click(Sender: TObject);
Begin
  close;

End;

Procedure Tfadepodurm.FormClose(Sender: TObject; Var Action: TCloseAction);
Begin
  dmrapor.atildepo.Close;
  durum.Close;
  action := cafree;
  fadepodurm := Nil;

End;

Procedure Tfadepodurm.Button1Click(Sender: TObject);
Begin
  dmrapor.atildepo.CLOSE;
  dmrapor.atildepo.Parameters.ParamByName('t1').value :=
    formatdatetime('dd.mm.yyyy', t1.date);
  dmrapor.atildepo.Parameters.ParamByName('t2').value :=
    formatdatetime('dd.mm.yyyy', t2.date);
  dmrapor.atildepo.Open;

End;

Procedure Tfadepodurm.Button4Click(Sender: TObject);
Begin
  dmrapor.atildeporap.Print;
End;

Procedure Tfadepodurm.wwDBGrid1CalcCellColors(Sender: TObject;
  Field: TField; State: TGridDrawState; Highlight: Boolean; AFont: TFont;
  ABrush: TBrush);
Begin
  durum.Close;
  durum.Parameters.ParamByName('serino').value :=
    dmrapor.atildepo.fieldbyname('serino').value;
  durum.open;

  If durum.FieldByName('depodurum').value = '1' Then
  Begin
    onay.Enabled := false;
  End
  Else
    onay.Enabled := true;

End;

Procedure Tfadepodurm.onayClick(Sender: TObject);
Begin
  If dmrapor.atildepo.fieldbyname('serino').value <> '' Then
  Begin
    durum.Edit;
    durum.FieldByName('depodurum').value := '1';
    durum.post;
    dmrapor.atildepo.Requery;
  End;
End;

End.